<template>
  <div class="wrap">
    <div class="cell">
      <span class="cell-l">用户:</span>
      <span>
        <input type="text" v-model="name" />
      </span>
    </div>
    <div class="cell">
      <span class="cell-l">密码:</span>
      <span>
        <input type="password" v-model="psw" />
      </span>
    </div>
    <div class="cell">
      <button class="button-s" @click="onLogin">登录</button>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      name: null,
      psw: null
    };
  },
  methods: {
    onLogin() {
      if (this.name == "sl" && this.psw == "sl39007309") {
        localStorage.setItem("user", this.name);
        this.$router.push({ name: "index" });
      }
    }
  }
};
</script>

<style scoped>
.wrap {
  text-align: center;
  padding: 25% 30%;
}
.cell {
  padding: 0.5rem;
}
.cell-l {
  text-align: center;
  color: #ff7a00;
  font-weight: bold;
  margin-right: 0.5rem;
}
.button-s {
  padding: 0.6rem;
  background: #ff7a00;
  color: #fff;
}
</style>
